using System;

namespace Laba3
{
    class MainClass
    {
        private static double EPS = 0.00001;

        public static bool CheckEps(double J2n, double Jn, int Meu){
            return (1/Meu)*Math.Abs((J2n - Jn)/J2n) < EPS;
        }

        public static void Main(string[] args)
        {
            double a = -1;
            double b = 1;
            int n = 2;
            Console.WriteLine("Trapeciya");
            while(!CheckEps(Trapec.Jn(a, b, n), Trapec.Jn(a, b, n/2), Trapec.Meu)){
                n+=n;
            }
            Console.WriteLine("N = {0}, Value = {1}", n, Trapec.Jn(a, b, n));

            n = 4;
            Console.WriteLine("Simpson");
            while(!CheckEps(Simpson.Jn(a, b, n), Simpson.Jn(a, b, n/2), Simpson.Meu)){
                n+=n;
                Console.WriteLine(n);
            }
            Console.WriteLine("N = {0}, Value = {1}", n, Simpson.Jn(a, b, n));
        }
    }
}
